const commentModel = require("../models/commentModel.js")

class Comment {
  add(article_id, user_id, content, parent_id, status) {
    const date = new Date();
    const d = date.toLocaleDateString();
    const t = date.toLocaleTimeString();
    const createAt = d + " " + t;
    return commentModel.add(article_id, user_id, content, parent_id, createAt, status);
  }

  getList(article_id, page_num, page_size) {
    return commentModel.getList(article_id, page_num, page_size);
  }

  delete(id, user_id) {
    return commentModel.delete(id, user_id);
  }

  getUserComments(user_id, page_num, page_size) {
    return commentModel.getUserComments(user_id, page_num, page_size);
  }

  getAllComments(page_num, page_size, keyword) {
    return commentModel.getAllComments(page_num, page_size, keyword);
  }

  hideComment(id) {
    return commentModel.hideComment(id);
  }

  restoreComment(id) {
    return commentModel.restoreComment(id);
  }

  adminDelete(id) {
    return commentModel.adminDelete(id);
  }
}

module.exports = Comment;

